package com.spectos.m42.blackberry.screen;

import net.rim.device.api.system.Bitmap;
import net.rim.device.api.system.EncodedImage;
import net.rim.device.api.ui.Color;
import net.rim.device.api.ui.Field;
import net.rim.device.api.ui.Graphics;
import net.rim.device.api.ui.component.BitmapField;
import net.rim.device.api.ui.component.LabelField;
import net.rim.device.api.ui.container.HorizontalFieldManager;
import net.rim.device.api.ui.container.MainScreen;


public class BaseScreen extends MainScreen {
	HorizontalFieldManager topBar;
	Bitmap imgTopBar = Bitmap.getBitmapResource("images/2.png");
	EncodedImage img = EncodedImage.getEncodedImageResource("images/top_bar.png");
	EncodedImage img2;
	public BaseScreen(){		
		int scaleX = 3;
		int scaleY = 1;
		img2 = img.scaleImage32(scaleX, scaleY);
		topBar = new HorizontalFieldManager(Field.USE_ALL_WIDTH | Field.NON_FOCUSABLE | HorizontalFieldManager.FIELD_HCENTER){
			
			protected void paint(Graphics graphics) {
				
				graphics.drawBitmap(0, 0, getWidth(), getHeight(), imgTopBar, 0, 0);
//				graphics.setBackgroundColor(Color.DARKBLUE);

//				graphics.fillRoundRect(0, 0,  getPreferredWidth(), getPreferredHeight(), 8, 8);
//				graphics.setColor(Color.BLACK);
//				graphics.drawRoundRect( 0, 0, getPreferredWidth(), getPreferredHeight(), 8, 8);				
//				graphics.clear();
				graphics.setColor(Color.WHITE);
				super.paint(graphics);
			}			
		};
		topBar.add(new BitmapField(Bitmap.getBitmapResource("images/logo_small.png"), FIELD_LEFT));
		topBar.add(new LabelField("Hello, username", Field.FIELD_RIGHT));	
		
		add(topBar);
	}
}
